﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using sexhealth.console.service.post.vo;
using sexhealth.console.service.post;

public partial class usercontrol_SearchResult : System.Web.UI.UserControl
{
    PostService postService = new PostService();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["q"] != null)
        {
            string q = HttpUtility.UrlDecode(Request["q"]);
            StringBuilder sb = new StringBuilder();
            IList<PostVO> postList = postService.DaoGetByWhere<PostVO>("KeyWord  LIKE '%" + q + "%'");
            sb.Append("<table width='584' border='0' cellpadding='0' cellspacing='5'>");
            foreach (PostVO p in postList)
            {
                sb.Append("<tr>");
                sb.Append("<td height='36' bgcolor='#E1E1E1'>");
                if (p.BelongToChannelId == 14 || p.BelongToChannelId == 15)
                {
                    sb.Append("<a href='mediadetail.aspx?chid=" + p.BelongToChannelId + "&pid=" + p.PostNo + "' class='b04'>" + p.Title + "</a>");

                }
                else
                {
                    sb.Append("<a href='postdetail.aspx?chid=" + p.BelongToChannelId + "&pid=" + p.PostNo + "' class='b04'>" + p.Title + "</a>");
                } sb.Append("</td>");
                sb.Append("</tr>");
            }
            sb.Append("</table>");
            ltlResult.Text = sb.ToString();
        }






    }
}
